
#if _MSC_VER > 1000
#pragma once
#endif

#ifndef __UFFS_DIRECTORY_H_
#define __UFFS_DIRECTORY_H_

#define _NO_CUFFSDIRECTORY_CLASSOBJECT_

#include "_CUffsDirectory.h"

#include "uffs\uffs.h"
#include "uffs\uffs_fs.h"

#include "CUffsDirStrEnumerator.h"

class CUffsDirectory : public _CUffsDirectory
{
public:
    CUffsDirectory();

    ~CUffsDirectory();

    ECode Initialize(uffs_Object *objHandle);

    ECode GetObjectInfo(int type, Int32 *pData);

    CARAPI Sync();

    CARAPI GetType(
        /* [out] */ FileType * pType);

    CARAPI GetAccessTime(
        /* [out] */ Int32 * pTime);

    CARAPI GetTime(
        /* [out] */ Int32 *pTime);

    CARAPI SetAccessTime(
        /* [in] */ Int32 time);

    CARAPI GetModificationTime(
        /* [out] */ Int32 * pTime);

    CARAPI SetModificationTime(
        /* [in] */ Int32 time);

    CARAPI GetCreateTime(
        /* [out] */ Int32 * pTime);

    CARAPI CheckAccessMode(
        /* [in] */ FileAccessMode mode);

    CARAPI GetAccessMode(
        /* [out] */ FileAccessMode * pMode);

    CARAPI SetAccessMode(
        /* [in] */ FileAccessMode mode);

    CARAPI GetShareMode(
        /* [out] */ FileShareMode *pMode);

    CARAPI SetShareMode(
        /* [in] */ FileShareMode mode);

    CARAPI Lookup(
        /* [in] */ WString wstrPath,
        /* [out] */ IBasicFile **basicFile);

    CARAPI CreateFile(
        /* [in] */ WString wstrPath,
        /* [in] */ FileAccessMode amode,
        /* [in] */ Boolean bExclusive,
        /* [out] */ IBasicFile * * pUfsFile);

    CARAPI DeleteFile(
        /* [in] */ WString wszFileName);

    CARAPI DeleteDirectory(
        /* [in] */ WString wszDirName);

    CARAPI Rename(
        /* [in] */ WString wstrOldPath,
        /* [in] */ IBasicDirectory * pNewDir,
        /* [in] */ WString wstrNewPath);

    CARAPI CreateDirectory(
        /* [in] */ WString wstrPath,
        /* [in] */ FileAccessMode amode);

    CARAPI GetDirEntries(
        /* [out] */ IWStringEnumerator ** dirEntries);

    CARAPI AddFileMonitor(
        /* [out] */ IEvent **ppEvent);

    CARAPI RemoveFileMonitor(
        /* [in] */ IEvent *pEvent);

    CARAPI ParseRelativePath(
        /* [in] */ const wchar_t *wstrPath,
        /* [out] */ Int32 *pFather,
        /* [out] */ wchar_t **pFileName);

    Int32 GetSerial();

private:
    uffs_Object m_objHandle;
    Boolean m_bInited;

};


#endif //__UFFS_DIRECTORY_H_
